package com.yugao.fintech.antelope.infra.module.file;

import com.yugao.fintech.antelope.base.model.constants.CommonCons;
import com.yugao.fintech.framework.assistant.utils.StringUtils;
import com.yugao.fintech.framework.assistant.utils.exception.BizException;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;


@Data
@ConfigurationProperties(prefix = CommonCons.PROPERTIES_PREFIX + "file")
public class FileProperties {

    /**
     * 单独配置内网url, 子服务必须配置
     */
    private String intranetUrl = "http://127.0.0.1:9090";

    /**
     * 桶名
     */
    private String bucketName = "draper-antelope";

    @PostConstruct
    public void init() {
        if (StringUtils.isEmpty(this.getIntranetUrl())) {
            throw new BizException("未配置内网文件地址");
        }
    }
}
